﻿<!--#include file="admin/Includes/constants.asp"-->
<!--#include file="admin/Includes/validate.asp"-->
<%
SSLMode = 1
'------------Authentication----------------------------
Verify
'------------Authentication----------------------------
MakeSSL 1
Dim aData, rCount, nRows, hasData, Image
Dim fkCountry, fYear, fkSeason, kDesigner, Permission, SortBy, SortOrder
Dim fCount1, SubCatName, uSubCatName
Dim CurPgNum, TotalMatches, TotalPages, TotalSets, CurPgSet, SetLBound, SetUBound
Dim PgActiveFont, PgActiveLink_o, PgActiveLink_c, j, aClass, tdClass
Dim SubCatID

'Default CurPgNum
If Request("cp") = "" Then
	CurPgNum = cint("1")
Else
	CurPgNum = Cint(Request("cp"))
End If

'Sort
SortBy = request("sb")
SortOrder = request("so")

strSQL = "{CALL a_user_favarticles_sel ('"& CookieID &"','"&SortBy&"', '"&SortOrder&"', "&CurPgNum&")}"	
exec(strsql)

	If Not RS Is Nothing Then
	If Not RS.EOF Then
		aData = RS.getrows
		nRows = Ubound(aData,2)	
		hasData=True			
	End If
		Set RS=RS.NextRecordSet
	End If
	If Not RS Is Nothing Then
	If Not RS.EOF Then		
		'Paging Totals
		TotalMatches 	= Cint(RS(0))
		TotalPages 		= Cint(RS(1))	
		TotalSets		= Cint(RS(2))	
		CurPgSet 		= Cint(RS(3))
		PageSetSize 	= Cint(RS(4))
		SetLBound  		= Cint(RS(5))
		SetUBound 	 	= Cint(RS(6))
	End If
	End If	
	
	CloseCon

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<Meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>Bài yêu thích</title>
	<Meta http-equiv=" content-language" content ="vi">
	<Meta name="Robots" content="noindex,nofollow">
	<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> 
	<link rel="icon" href="favicon.ico" type="image/x-icon"> 
	<link rel="STYLESHEET" type="text/css" href="system/styles.css">
	<script language="javascript" src="Admin/javascripts/handler.js"></script>
</head>
<body>
<div id="container">
<div id="bt2"><img src="hinh-thoi-trang/bg_top.gif" width="1049" height="20"></div>
<div id="tp">
<table border="0" cellpadding="0" cellspacing="0" width="990" align="center">	
	<!--#include file="system/top.asp" -->
	<tr bgcolor="#6b5a60">
		<td width="160" style="height:1px;"><img src="hinh-thoi-trang/de_clear.gif" alt="" width="1" height="1" border="0"></td>
		<td width="522" valign="top" rowspan="2">
		<!--body content-->		
			<!--cover-->		
		<table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#B6A8AD">	
			<form action="user_favarticles.asp?cp=<%=CurPgNum%>&ckid=<%=ckid%>" method="post">			
			<tr><td colspan="1" style="padding-left:13px;padding-top:3px;"><img src="hinh-thoi-trang/bai-yeu-thich-hp.gif" width="400" height="40"></td></tr>				
			

			<!--Filter-->				
			<tr>				
				<td valign=top>
				<table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#C0A79E">						
				<tr><td bgcolor="#E5DFE1" width="98%"><img src="hinh-thoi-trang/de_clear.gif" alt="" width="1" height="1" border="0"></td></tr>
				<tr>
					<td style="padding-left:12px;">															
							<table border="0" cellpadding="1" cellspacing="0">		
							<tr>
								
								<td class="fTitle">Theo</td>
								<td class="fTitle">Thứ tự</td>									
								<td>&nbsp;</td>								
							</tr>
							<tr>																							
								<td><select name="sb" class="ftext">
										<option value="F.ID" <% If SortBy="F.ID" Then %>SELECTED<% End If %>>Thứ tự lưu vào</option>
										<option value="A.uTitle" <% If SortBy="A.uTitle" Then %>SELECTED<% End If %>>Tên bài</option>
									</select>
								</td>	
								<td><select name="so" class="ftext">
										<option value="DESC" <% If SortOrder="DESC" Then %>SELECTED<% End If %>>z-a</option>
										<option value="ASC" <% If SortOrder="ASC" Then %>SELECTED<% End If %>>a-z</option>	
									</select>
								</td>										
								
								<td><input type="submit" value="SẮP XẾP" class="btnGo"></td>																			
							</tr>															
							</table>						
					</td>						
				</tr>
				<tr><td><img src="hinh-thoi-trang/de_clear.gif" alt="" width="1" height="10" border="0"></td></tr>			
				</table>	
				</td>
			</tr>			
			</form>		
			<!--/Filter-->

			<tr bgcolor="#000000"><td colspan="9"><img src="hinh-thoi-trang/de_clear.gif" width="1" height="1" border="0"></td></tr>
			<tr bgcolor="#E5DFE1"><td colspan="9"><img src="hinh-thoi-trang/de_clear.gif" width="1" height="1" border="0"></td></tr>	
						
			<!--Product Listings-->
				<% 	
				InitArticleNaming
				Dim c_ColPerRow, c_StartCel, c_EndCel, c_nFillCels, c_isRowEnd, c_DataTotal, c_Count, c_arrData
				Dim tdcolor				
				If hasData Then 					
				'Assign variables
				c_ColPerRow = 3
				c_DataTotal = nRows
				c_Count = rCount											
				'system-calculations----------------------------------------------
				If (c_DataTotal+1) Mod c_ColPerRow > 0 Then
					c_EndCel = (Int(((c_DataTotal+1)/c_ColPerRow))+1)*c_ColPerRow-1
				Else
					c_EndCel = c_DataTotal
				End If						
					c_nFillCels = c_EndCel - (c_DataTotal+1)
				'system-calculations----------------------------------------------						
				%>
				<!--system header-->
				<tr>					
					<td>
					<table border="0" cellpadding="0" cellspacing="1" width="100%" bgcolor="#B6A8AD">		
						<!--top border line-->	
						<tr>
				<!--/system header-->					
						<% 	
						tdcolor = "bgcolor=""#F7F6BD"""
						For c_Count = 0 To c_EndCel 							
							'system--------------------------------
							If ((c_Count+1) Mod c_ColPerRow)=0 Then
								c_isRowEnd = True
							End If
							'system--------------------------------	
							If ((c_Count+1) Mod 3)=0 Then
								tdcolor = "bgcolor=""#F7F6BD"""
							End If							
							'Write data Start
							If c_Count <= c_DataTotal Then 'Real Data
								'Image = Replace(aData(2,c_Count)," ","-") & "-l" & aData(0,c_Count) & "-" & aData(3,c_Count)
								Image = getNameImage (getPrefixName(aData(5, c_Count), aData(2,c_Count)) , ImgList, aData(0, c_Count) , aData(3,c_Count) )  
								%>																
								<td valign="top" <%= tdcolor %> class="lsTD"><h5 style="font-weight:bold">
									<a href="user_detail.asp?aid=<%= aData(0,c_Count) %>&ckid=<%=ckid%>" class="lsTitle2"><img src="hinh-anh-nguoi-mau/<%= Image %>" width="150" height="150" border="0" vspace="7"></a>
									<a href="user_detail.asp?aid=<%= aData(0,c_Count) %>&ckid=<%=ckid%>" class="lsTitle2" style="margin-right:5px"><%= aData(1,c_Count)%></a>
									<a href="user_fav_add.asp?a=del&dt=2&fid=<%=aData(4,c_Count)%>&ckid=<%=ckid%>" onClick="return confirmDelete('Bạn có thật sự muốn xóa bài này không?');"><img src="../hinh-thoi-trang/ico_delete.gif" alt="Xóa bài" align="absmiddle"></a>
									</h5>					
								</td>								
							<%	If 	tdcolor = "bgcolor=""#F7F6BD""" Then
									tdcolor = "bgcolor=""#F7F6BD"""
								Else
									tdcolor = "bgcolor=""#F7F6BD"""
								End If							
							Else 'Fill Cells
								If ((c_Count+1) Mod 3)=0 Then
									tdcolor = "bgcolor=""#F7F6BD"""
								End If
								response.write "<td " & tdcolor & "><img src='hinh-thoi-trang/de_clear.gif' width='104' height='55' border='0'></td>" & vbcrlf	
								If 	tdcolor = "bgcolor=""#F7F6BD""" Then
									tdcolor = "bgcolor=""#F7F6BD"""
								Else
									tdcolor = "bgcolor=""#F7F6BD"""
								End If								
							End If
							'Write data End							
							'system-------------------------------
							If c_isRowEnd Then							
								response.write "</tr>" & vbcrlf		
								If c_Count < c_EndCel Then
									response.write "<tr>" & vbcrlf	
								End If								
								c_isRowEnd = False
							End If								
							'system-------------------------------							
							Next %>							
				<!--system footer-->	
						</tr>
					</table>
					</td>
				</tr>
				<!--/system footer-->	
				<% Else %>
				<tr bgcolor="#F7F6BD">
					<td style="padding:20px 10px 10px 13px" valign="top" class="lsTitle">Bạn chưa lưu bài yêu thích nào!</td>
				</tr>					
				<% 	End If		
				DisposeArticleNaming
				%>
			<!--/Product Listing-->	
			<tr>
				<td valign="top">	
				<table cellpadding="0" cellspacing="0" width="100%" border="0">			
				<!--Paging -->
				<% If TotalPages > 0 Then %>					
				<tr bgcolor="#FFFFFF"><td colspan="9"><img src="hinh-thoi-trang/de_clear.gif" width="1" height="1" border="0"></td></tr>
				<tr><td><img src="hinh-thoi-trang/de_clear.gif" width="1" height="3" border="0"></td></tr>
				<tr>								
					<td colspan="3" class="paging" style="padding-left:12">Trang <%= CurPgNum %>/<%= TotalPages %></td>
					<td class="paging"><%= TotalMatches %> bài tổng cộng</td>
					<td colspan="5" align="right" style="padding-right:5px;">
						<table cellspacing="0" cellpadding="0" border="0">
							<tr>
								<% If cint(CurPgSet) >  1 Then%>
								<td><a href="user_favarticles.asp?cp=<%=CurPgNum-PageSetSize%>&sb=<%=SortBy%>&so=<%=SortOrder%>&ckid=<%=ckid%>"><img src="hinh-thoi-trang/nav_previousset_on.gif" width="28" height="17" border="0"></a></td>
								<% Else  %>
								<td><img src="hinh-thoi-trang/nav_previousset_off.gif" width="28" height="17" border="0"></td>
								<% End If %>								
								<% If cint(CurPgNum) > 1 Then %>
								<td><a href="user_favarticles.asp?cp=<%= CurPgNum - 1%>&sb=<%=SortBy%>&so=<%=SortOrder%>&ckid=<%=ckid%>"><img src="hinh-thoi-trang/nav_previouspage_on.gif" width="28" height="17" border="0" hspace="3"></a></td>
								<% Else  %>
								<td><img src="hinh-thoi-trang/nav_previouspage_off.gif" width="28" height="17" border="0" hspace="3"></td>
								<% End If %>								
								<%		For j = SetLBound To SetUBound													
											If j > TotalPages Then 'Case off
												tdClass = "class='pagingOff'" 
												aClass = ""
												PgActiveLink_o = ""
												PgActiveLink_c = ""
											Else 'Case on
												If j = CurPgNum Then 'Case on and selected		
													tdClass = "class='pagingSelected'"	
													aClass = "class='pagingSelected'"														
												Else 'Case on only no selected
													aClass = "class='pagingOn'"	
													tdClass = ""
												End If
												PgActiveLink_o = "<a href='user_favarticles.asp?cp=" & j & "&sb="&SortBy&"&so="&SortOrder &"&ckid=" & ckid & "' " & aClass & ">"
												PgActiveLink_c = "</a>"
											End If														
								%>
										<td width="10%" align="center" valign="middle" <%= tdClass %>><%= PgActiveLink_o %><%= j %><%= PgActiveLink_c %></td>												
								<%		Next %>								
								<% If cint(CurPgNum) <  cint(TotalPages) Then%>
								<td><a href="user_favarticles.asp?cp=<%=CurPgNum + 1%>&sb=<%=SortBy%>&so=<%=SortOrder%>&ckid=<%=ckid%>"><img src="hinh-thoi-trang/nav_nextpage_on.gif" width="28" height="17" border="0" hspace="3"></a></td>
								<% Else  %>
								<td><img src="hinh-thoi-trang/nav_nextpage_off.gif" width="28" height="17" border="0" hspace="3"></td>
								<% End If %>
								
								<% If CurPgSet <  TotalSets AND (CurPgNum+Cint(PageSetSize)) <= TotalPages Then%>
								<td><a href="user_favarticles.asp?cp=<%= CurPgNum + PageSetSize %>&sb=<%=SortBy%>&so=<%=SortOrder%>"><img src="hinh-thoi-trang/nav_nextset_on.gif" width="28" height="17" border="0"></a></td>
								<% Else  %>
								<td><img src="hinh-thoi-trang/nav_nextset_off.gif" width="28" height="17" border="0"></td>
								<% End If %>
								
							</tr>
						</table>
					</td>
				</tr>	
				<tr><td><img src="hinh-thoi-trang/de_clear.gif" width="1" height="3" border="0"></td></tr>
				<tr bgcolor="#000000"><td colspan="9"><img src="hinh-thoi-trang/de_clear.gif" width="1" height="1" border="0"></td></tr>							
				<% End If %>		
				</table>		
				<!--/paging-->
				</td>
			</tr>
		</table>
			<!--/text-->		
		<!--/body content-->
		</td>
		<td width="308" style="height:1px"><img src="hinh-thoi-trang/de_clear.gif" alt="" width="1" height="1" border="0"></td>
	</tr>
	<!--main body-->
	<tr bgcolor="#ffffff">
		<td bgcolor="#000000" width="160" valign="top">
			<!--#include file="system/left_user.asp" -->
		</td>
		<!--missing 1 TD because of Rowspan-->
		<td bgcolor="#614B00" width="308" valign="top">
			<table border="0" cellpadding="0" cellspacing="0" width="308" align="right">
				<tr bgcolor="#000000"><td colspan="2"><img src="hinh-thoi-trang/de_clear.gif" alt="" width="1" height="1" border="0"></td></tr>
				<form action="listing.asp?ckid=<%=ckid%>" method="post">
				<tr bgcolor="#8D0045">
					<td width="154" valign="top" height="33" ><input type="text" name="search" value="Tìm kiếm" size="22" class="txtSearch"></td>
					<td width="154" valign="top" style="padding-top:7px;padding-left:3px;"><input type="submit" name="go" value="TÌM" class="btnGo"></td>
				</tr>
				</form>
				<tr bgcolor="#000000"><td colspan="2"><img src="hinh-thoi-trang/de_clear.gif" alt="" width="1" height="1" border="0"></td></tr>
				<!--Ads Starts-->
				<tr><td align="center" colspan="2"><img src="hinh-quang-cao/neimanmarcus350x250.jpg" alt="" width="300" height="250" border="0"></td></tr>
				<!--Ads Ends-->
			</table>
		</td>
	</tr>
	<!--/main body-->
	<!--bottom-->
	<!--#include file="system/bottom.asp" -->
</table>
</div>
<div id="bt2"><img src="hinh-thoi-trang/bg_bottom.gif" width="1049" height="20"></div>
</div>
</body>
</html>
